<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>活动门店兑换记录</title>
    <link rel="stylesheet" href="common/js/file-input/fileinput.css">
    <link rel="stylesheet" href="common/css/switchery/style.css">
    <link rel="stylesheet" href="common/css/bootstrap.css">
    <link rel="stylesheet" href="common/css/font-awesome.min.css">
    <link rel="stylesheet" href="common/css/style.css">
    <link rel="stylesheet" href="common/css/plugin.css">
    <link rel="stylesheet" href="common/js/datepicker/bootstrap-datetimepicker.css">
    <script src="common/js/jquery-1.11.1.min.js" type="text/javascript"></script>
    <!--[if lt IE 9]>
    <script src="common/js/ie/respond.min.js"></script>
    <script src="common/js/ie/html5.js"></script>
    <![endif]-->
</head>
<body onload="initTab()">
<!-- .modal 发送提示 -->
<div class="modal fade operaState in " data-keyboard="false" id="operaState">
    <div class="modal-dialog modal-sm" style="margin-left:-150px;">
        <div class="modal-content">
            <div class="modal-body pop-div-content">
                <p><i class="icon-success"></i></p>

                <p class="tipP">
                    <label id="promptMsg"></label>
                </p>
            </div>
        </div>
    </div>
</div>
<section class="main padder">
    <div class="clearfix">
        <h4><i class="icon-list"></i> 活动门店兑换记录</h4>
    </div>
    <section class="panel">
        <div class="tab-content">
            <div id="actStoreList" class="tab-pane fade active in">
                <div class="row">
                    <label class="col-lg-8 control-label text-left">活动名称：
                        <label id="actName"></label>
                    </label>
                </div>
                <div class="row">
                    <div class="col-lg-12">
                        <section class="panel">
                            <div class="pull-out">
                                <table class="table table-striped m-b-none" data-ride="datatables">
                                    <thead>
                                    <tr>
                                        <th>门店名称</th>
                                        <th>商户名称</th>
                                        <th>已兑换总数</th>
                                        <th>兑换成功数</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    </tbody>
                                </table>
                            </div>
                        </section>
                    </div>
                </div>
            </div>
        </div>
    </section>
</section>


<!-- /.modal 发送提示 -->
<script src="common/js/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="common/js/bootstrap.min.js" type="text/javascript"></script>
<script src="common/js/index.js" type="text/javascript"></script>
<!-- 验证 -->
<script src="common/js/parsley/parsley.js" type="text/javascript"></script>
<!-- checkbox -->
<script src="common/js/fuelux/fuelux.js" type="text/javascript"></script>

<!-- datatables -->
<script src="common/js/datatables/jquery.dataTables10.min.js" type="text/javascript"></script>
<script src="common/js/datepicker/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
<script src="common/js/datepicker/bootstrap-datetimepicker.zh-CN.js" type="text/javascript"></script>
<script src="static/js/bootbox.min.js" type="text/javascript"></script>
<script>
    $(".datetimepicker").each(function () {
        var $this = $(this);
        $this.datetimepicker({
            format: "yyyy-mm-dd hh:ii:ss",
            autoclose: true,
            language: 'zh-CN',
            todayHighlight: true
        });
    });
    $("#jifenStartTime").datetimepicker().on('hide', function (e) {
        $("#jifenEndTime").datetimepicker('setStartDate', $("#jifenStartTime").val());
    });
    $('#jifenEndTime').datetimepicker().on('hide', function (e) {
        $('#jifenStartTime').datetimepicker('setEndDate', $("#jifenEndTime").val());
    });
    $("#startTime").datetimepicker().on('hide', function (e) {
        $("#endTime").datetimepicker('setStartDate', $("#startTime").val());
    });
    $('#endTime').datetimepicker().on('hide', function (e) {
        $('#startTime').datetimepicker('setEndDate', $("#endTime").val());
    });
</script>
<script>
    function GetRequest() {
        var url = decodeURI(location.search); //获取url中"?"符后的字串
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            var strs = str.split("&");
            for (var i = 0; i < strs.length; i++) {
                theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
            }
        }
        return theRequest;
    }
</script>
<script>
    var Request = GetRequest();
    var actId = Request["id"];
    var actName = Request["name"];
    $("#actName").html(actName);
    var table;
    var page = 1;
    function initTab() {

//        if ($.type(table) != 'object') {
        table = $('#actStoreList').find('table[data-ride="datatables"]').DataTable({
            "ajax": {
                url: "activitysys/findActStoreByList?actId=" + actId,
                type: "post",
            },
            "processing": true,
            "serverSide": true,
            "autoWidth": true,
            "searchDelay": 500,
            "displayStart": parseInt(page) * 10 - 10,
            "pagingType": "full_numbers",
            "pageLength": 10,
            "dom": "<'row'<'col col-lg-6'l><'col col-lg-6'f>r>t<'row'<'col col-lg-6'i><'col col-lg-6'p>>",
            "aaSorting": [[1, "desc"]],//默认排序
            "columns": [
//                    {"data": "id", "name": "id", "width": "100px"},
                {"data": "storeName", "name": "storeName", "width": "90px", "sortable": false},
                {"data": "merchantName", "name": "merchantName", "width": "100px"},
                {"data": "verifyCount", "name": "verifyCount", "width": "100px"},
                {"data": "exchangeCount", "name": "exchangeCount", "width": "100px"},
                {"data": null, "width": "170px"}
            ],
            "columnDefs": [
                {"searchable": false, "targets": [1, 2]},
                {
                    "targets": 4,
                    "data": null,
                    "sortable": false,
                    "render": function (data, type, full) {
                        if (full['activityType'] == '01') {
                            return '<a href="storeIntegralRecord.html?storeId=' + full['storeId'] + '&storeName=' + full['storeName']
                                    + "&activityId=" + actId + "&activityName=" + actName + '"target="_blank" >查看兑换记录</a>';
                        } else {
                            return '<a href="storeCodeRecord.html?storeId=' + full['storeId'] + '&storeName=' + full['storeName']
                                    + "&activityId=" + actId + "&activityName=" + actName + '"target="_blank" >查看兑换记录</a>'
                        }
                    }
                }
            ]
        });
//        }
    }
</script>
</body>
</html>